<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 自定义迭代器 
        var arr = ["张三","李四","王五"];

        // function myInterator(arr){
        //     let count = 0;  // 初始化调取第一个元素；
        //     return {
        //         next(){
        //             return {
        //                 value:arr[count++],
        //                 done:count>arr.length?true:false
        //             }
        //         }
        //     }
        // }

        // let interatorObj = myInterator(arr);
        // console.log(interatorObj.next());
        // console.log(interatorObj.next());
        // console.log(interatorObj.next());
        // console.log(interatorObj.next());

    //     Array.prototype.myInterator = function(){
    //         let count = 0;  // 初始化调取第一个元素；
    //         return {
    //             next:()=>{
    //                 return {
    //                     value:this[count++],
    //                     done:count>this.length?true:false
    //                 }
    //             }
    //         }
    //     }
    //   var  interatorObj =  arr.myInterator();
    //   console.log(interatorObj.next());
    //   console.log(interatorObj.next());
    //   console.log(interatorObj.next());
    //   console.log(interatorObj.next());



    let obj = {
        myname:"张三",
        age:20
    }

//    var arr =  Object.entries(obj);
//    console.log(arr);

for(let [key,item] of Object.entries(obj)){
    console.log(key,item);
}


    </script>
</body>
</html>